// pages/mystore/index.js
import { apiUrls, makeRequest } from '../../utils/api'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    cdnUrl: 'http://static.xunyi.mobi/',
    items: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },
  onShow: function () {
    let that = this;
    makeRequest({
      url: apiUrls.getMyStore,
      method: 'GET',
      success: function (res) {
        let items = res.data.data.map((item) => {
          return {
            id: item.id,
            name: item.name,
            cover: item.cover,
            is_check: item.is_check
          }
        })
        that.setData({
          items
        })
      }
    })
  }
})